package main;

import processing.core.PApplet;
import processing.core.PGraphics;

public class Graphics extends PApplet {

    PGraphics pGraphics;

    @Override
    public void settings() {
        size(640, 360);
    }

    @Override
    public void setup() {
        pGraphics = createGraphics(400, 200);
    }

    @Override
    public void draw() {
        fill(0,12);
        rect(0, 0, width, height);
        fill(255);
        noStroke();
        ellipse(mouseX, mouseY, 60, 60);

        pGraphics.beginDraw();
        pGraphics.background(51);
        pGraphics.noFill();
        pGraphics.stroke(255);
        pGraphics.ellipse(mouseX - 120, mouseY - 60, 60, 60);
        pGraphics.endDraw();

        // draw the off_screen buffer to the screen with image()
        image(pGraphics, 120, 60);
    }
}
